As the miniaturization of semiconductor devices proceeds, contact plugs provided on a substrate, wiring, etc. have a higher aspect ratio. In the formation of a contact hole of a high aspect ratio, if a deposit is attached to the inner wall of the contact hole or, conversely, if the inner wall of the contact hole is hollowed, the bottom shape of the contact hole becomes a distorted shape largely different from the original layout shape. In this case, when a spacer film is formed on the inner surface of the contact hole, the spacer film may be locally formed thick on the bottom surface of the contact hole.
When the spacer film is locally formed thick on the bottom surface of the contact hole, it is difficult to remove the spacer film from the bottom surface of the contact hole, while maintaining the spacer film on the side surface of the contact hole. In this case, the contact resistance to the lower layer becomes high, so that contact failure tends to occur.